home *** CD-ROM | disk | FTP | other *** search
- //
- // MiscMergeEngine.h -- an engine for merging records into templates
- // Written by Don Yacktman Copyright (c) 1995 by Don Yacktman.
- // Version 1.0. All rights reserved.
- // This notice may not be removed from this source code.
- //
- // This object is included in the MiscKit by permission from the author
- // and its use is governed by the MiscKit license, found in the file
- // "LICENSE.rtf" in the MiscKit distribution. Please refer to that file
- // for a list of all applicable permissions and restrictions.
- //
-
-
- #import <appkit/appkit.h>
- #import <misckit/MiscMergeProtocols.h>
-
- @class List;
- @class MiscMergeCommand;
- @class MiscMergeTemplate;
- @class MiscString;
- @class MiscDictionary;
-
- @interface MiscMergeEngine : Object
- {
- id template;
- id dictionary;
- MiscMergeEngine *parentMerge;
- MiscDictionary *symbolTable;
- MiscDictionary *variables;
-
- // Used while doing a merge
- BOOL mergeInProgress, abort;
- id outputString;
- BOOL outputOK; // if off, inhibits output; used by conditionals, etc.
- id driver; // the "sender" that started the merge
- BOOL leaveDelimiters; // if on, delimiters are put on unresolved fields
- }
-
-
- // Creating and setting up an engine
- + newWithTemplate:(MiscMergeTemplate *)aTemplate;
- - init;
-
- // Setting up a merge
- - setTemplate:(MiscMergeTemplate *)aTemplate;
- - setMergeDictionary:(MiscDictionary *)aDictionary;
-
- // Performing a merge
- - (MiscString *)merge:sender;
- - (MiscString *)mergeWithDictionary:(MiscDictionary *)aDictionary
- sender:sender;
-
- // Setting a parent MergeEngine for sub-merges
- - setParentMerge:(MiscMergeEngine *)aMergeEngine;
- - (MiscMergeEngine *)parentMerge;
-
- // Primitives that may be used by MiscMergeCommands to implement
- // various functionality.
- - abortMerge;
- - advanceRecord;
- - appendToOutput:(MiscString *)newText;
- - (MiscDictionary *)dictionary;
-
- @end
-
- @interface MiscMergeEngine (Symbols)
-
- // Handling the local symbol table
- - resetSymbolTable;
- - (MiscString *)symbolForKey:(MiscString *)name;
- - setSymbol:(MiscString *)name toValue:(MiscString *)value;
- - (MiscString *)getField:(MiscString *)fieldName;
-
- // Handling merge "variables"
- - resetVariables;
- - getVariableNamed:(MiscString *)name;
- - setVariableNamed:(MiscString *)name to:aValue;
- - ifStack; // returns the mergers IF stack, a special variable
- - setLeaveDelimiters:(BOOL)aFlag;
- - (BOOL)leaveDelimiters;
-
- @end
-
- @interface MiscMergeEngine (GlobalSymbols)
-
- // Handling a global symbol table
- + resetGlobalSymbolTable;
- + setGlobalSymbol:name toValue:val;
- + addDictionaryToGlobalSymbols:(MiscDictionary *)aDictionary;
- + addListToGlobalSymbols:(List *)aList;
- + (MiscString *)globalSymbolForKey:(MiscString *)name;
-
- @end
-
-